package com.lzx.makeFriend.controller.web;

import com.lzx.common.utils.R;
import com.lzx.makeFriend.entity.Chat;
import com.lzx.makeFriend.entity.vo.NicknameVO;
import com.lzx.makeFriend.entity.vo.OssVO;
import com.lzx.makeFriend.service.ChatService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/makeFriend/chat/web")
public class WebChatController {
    @Resource
    private ChatService chatService;

    //修改用户昵称(好友聊天)
    @PutMapping("/updateNicknameToChat")
    public String updateNicknameToChat(@RequestBody NicknameVO nicknameVO) {
        return chatService.updateNicknameToChat(nicknameVO);
    }

    //修改用户头像(好友聊天)
    @PutMapping("/updateAvatarToChat")
    public String updateAvatarToChat(@RequestBody OssVO ossVO) {
        return chatService.updateAvatarToChat(ossVO);
    }

    //获取当前用户的好友聊天内容
    @GetMapping("/getUserFriendChatContent/{userId}/{friendId}")
    public R getUserFriendChatContent(@PathVariable Long userId, @PathVariable Long friendId) {
        return chatService.getUserFriendChatContent(userId, friendId);
    }

    //朋友聊天
    @PostMapping("/friendChat")
    public R friendChat(@RequestBody Chat chat) {
        return chatService.friendChat(chat);
    }
}
